package routers

import (
	"supershare/backend/controllers"
	"supershare/backend/controllers/api"
	"supershare/backend/middleware"
	"supershare/backend/middlewares"

	"github.com/beego/beego/v2/server/web"
)

func init() {
	// 注册API路由
	ns := web.NewNamespace("/api",
		// 认证相关路由
		web.NSNamespace("/auth",
			web.NSRouter("/login", &controllers.UserController{}, "post:Login"),
		),
		// 用户相关路由
		web.NSNamespace("/user",
			web.NSRouter("/info", &controllers.UserController{}, "get:GetInfo"),
		),
		// 美团API接口路由
		web.NSRouter("/meituan/callback", &api.MeituanController{}, "post:ReceiveCallback"),
		web.NSRouter("/meituan/sync", &api.MeituanController{}, "post:SyncOrders"),
		web.NSNamespace("/v1",
			// 文件上传相关路由
			web.NSRouter("/upload", &controllers.UploadController{}, "post:Upload"),
			web.NSRouter("/upload/multi", &controllers.UploadController{}, "post:UploadMulti"),
			// 用户管理相关路由
			web.NSRouter("/user", &controllers.UserController{}, "get:List"),
			web.NSRouter("/user", &controllers.UserController{}, "post:Create"),
			web.NSRouter("/user/:id", &controllers.UserController{}, "put:Update"),
			web.NSRouter("/user/:id", &controllers.UserController{}, "delete:Delete"),
			// 操作日志相关路由
			web.NSRouter("/log", &controllers.LogController{}, "get:List"),
			// 角色管理相关路由
			web.NSRouter("/role", &controllers.RoleController{}, "get:List"),
			web.NSRouter("/role", &controllers.RoleController{}, "post:Create"),
			web.NSRouter("/role/:id", &controllers.RoleController{}, "put:Update"),
			web.NSRouter("/role/:id", &controllers.RoleController{}, "delete:Delete"),
			web.NSRouter("/role/:id/permission", &controllers.RoleController{}, "get:GetRolePermissions"),
			web.NSRouter("/role/:id/permission", &controllers.RoleController{}, "post:UpdateRolePermissions"),
			// 权限管理相关路由
			web.NSRouter("/permission", &controllers.PermissionController{}, "get:List"),
			web.NSRouter("/permission", &controllers.PermissionController{}, "post:Create"),
			web.NSRouter("/permission/:id", &controllers.PermissionController{}, "put:Update"),
			web.NSRouter("/permission/:id", &controllers.PermissionController{}, "delete:Delete"),
			web.NSRouter("/permission/batch/parent", &controllers.PermissionController{}, "post:BatchUpdateParent"),
			// 加盟商管理相关路由
			web.NSRouter("/franchise", &controllers.FranchiseController{}, "get:List"),
			web.NSRouter("/franchise", &controllers.FranchiseController{}, "post:Create"),
			web.NSRouter("/franchise/:id", &controllers.FranchiseController{}, "put:Update"),
			web.NSRouter("/franchise/:id", &controllers.FranchiseController{}, "delete:Delete"),
			// 城市管理相关路由
			web.NSRouter("/city", &controllers.CityController{}, "get:List"),
			web.NSRouter("/city/all", &controllers.CityController{}, "get:GetAll"),
			web.NSRouter("/city", &controllers.CityController{}, "post:Create"),
			web.NSRouter("/city/:id", &controllers.CityController{}, "put:Update"),
			web.NSRouter("/city/:id", &controllers.CityController{}, "delete:Delete"),
			// 门店管理相关路由
			web.NSRouter("/store", &controllers.StoreController{}, "get:List"),
			web.NSRouter("/store", &controllers.StoreController{}, "post:Create"),
			web.NSRouter("/store/:id", &controllers.StoreController{}, "get:GetOne"),
			web.NSRouter("/store/:id", &controllers.StoreController{}, "put:Update"),
			web.NSRouter("/store/:id", &controllers.StoreController{}, "delete:Delete"),
			// 门店营业时间相关路由
			web.NSRouter("/store/time/:id", &controllers.StoreTimeController{}, "get:GetStoreTime"),
			web.NSRouter("/store/time", &controllers.StoreTimeController{}, "post:SaveStoreTime"),
			// 场地管理相关路由
			web.NSRouter("/venue", &controllers.VenueController{}, "get:List"),
			web.NSRouter("/venue", &controllers.VenueController{}, "post:Create"),
			web.NSRouter("/venue/:id", &controllers.VenueController{}, "get:GetOne"),
			web.NSRouter("/venue/:id", &controllers.VenueController{}, "put:Update"),
			web.NSRouter("/venue/:id", &controllers.VenueController{}, "delete:Delete"),
			web.NSRouter("/venue/batch", &controllers.VenueController{}, "post:Batch"),

			// 预约配置管理相关路由
			web.NSRouter("/booking/setting", &controllers.BookingSettingController{}, "get:GetAll"),
			web.NSRouter("/booking/setting/:store_id", &controllers.BookingSettingController{}, "get:GetByStoreId"),
			web.NSRouter("/booking/setting", &controllers.BookingSettingController{}, "put:Update"),
			web.NSRouter("/booking/setting/:id", &controllers.BookingSettingController{}, "delete:Delete"),
			// 场地类型管理相关路由
			web.NSRouter("/venue/type", &controllers.VenueTypeController{}, "get:GetAll"),
			web.NSRouter("/venue/type", &controllers.VenueTypeController{}, "post:Create"),
			// 场地预约套餐管理相关路由
			web.NSRouter("/venue/package", &controllers.VenuePackageController{}, "get:List"),
			web.NSRouter("/venue/package", &controllers.VenuePackageController{}, "post:Create"),
			web.NSRouter("/venue/package/:id", &controllers.VenuePackageController{}, "get:GetOne"),
			web.NSRouter("/venue/package/:id", &controllers.VenuePackageController{}, "put:Update"),
			web.NSRouter("/venue/package/:id", &controllers.VenuePackageController{}, "delete:Delete"),
			web.NSRouter("/venue/timeline_list", &api.VenueController{}, "get:TimelineList"),

			// 小程序配置管理
			web.NSRouter("/miniprogram/config", &controllers.MiniprogramConfigController{}, "get:Get"),
			web.NSRouter("/miniprogram/config", &controllers.MiniprogramConfigController{}, "put:Put"),
			web.NSRouter("/miniprogram/config/upload_cert", &controllers.MiniprogramConfigController{}, "post:UploadCert"),

			// 小程序内容管理
			web.NSRouter("/miniprogram/content", &controllers.MiniprogramContentController{}, "get:Get"),
			web.NSRouter("/miniprogram/content", &controllers.MiniprogramContentController{}, "post:Post"),
			web.NSRouter("/miniprogram/content/:id", &controllers.MiniprogramContentController{}, "put:Put"),
			web.NSRouter("/miniprogram/content/:id", &controllers.MiniprogramContentController{}, "get:GetOne"),
			web.NSRouter("/miniprogram/content/:id", &controllers.MiniprogramContentController{}, "delete:Delete"),

			// 小程序轮播图管理
			web.NSRouter("/miniprogram/banner", &controllers.MiniprogramBannerController{}, "get:Get"),
			web.NSRouter("/miniprogram/banner", &controllers.MiniprogramBannerController{}, "post:Post"),
			web.NSRouter("/miniprogram/banner/:id", &controllers.MiniprogramBannerController{}, "put:Put"),
			web.NSRouter("/miniprogram/banner/:id", &controllers.MiniprogramBannerController{}, "get:GetOne"),
			web.NSRouter("/miniprogram/banner/:id", &controllers.MiniprogramBannerController{}, "delete:Delete"),
			web.NSRouter("/miniprogram/banner/sort", &controllers.MiniprogramBannerController{}, "put:UpdateSort"),

			// 充值套餐管理相关路由
			web.NSRouter("/recharge/package", &controllers.RechargePackageController{}, "get:List"),
			web.NSRouter("/recharge/package", &controllers.RechargePackageController{}, "post:Create"),
			web.NSRouter("/recharge/package/:id", &controllers.RechargePackageController{}, "get:GetOne"),
			web.NSRouter("/recharge/package/:id", &controllers.RechargePackageController{}, "put:Update"),
			web.NSRouter("/recharge/package/:id", &controllers.RechargePackageController{}, "delete:Delete"),
			web.NSRouter("/recharge/package/active", &controllers.RechargePackageController{}, "get:GetActive"),

			// 充值记录管理相关路由
			web.NSRouter("/recharge/record", &controllers.RechargeRecordController{}, "get:List"),
			web.NSRouter("/recharge/record", &controllers.RechargeRecordController{}, "post:Create"),
			web.NSRouter("/recharge/record/:id", &controllers.RechargeRecordController{}, "get:GetOne"),
			web.NSRouter("/recharge/record/order", &controllers.RechargeRecordController{}, "get:GetByOrderNo"),
			web.NSRouter("/recharge/record/status", &controllers.RechargeRecordController{}, "post:UpdateStatus"),

			// 会员管理相关路由
			web.NSRouter("/member", &controllers.MemberController{}, "get:List"),
			web.NSRouter("/member", &controllers.MemberController{}, "post:Create"),
			web.NSRouter("/member/:id", &controllers.MemberController{}, "get:GetOne"),
			web.NSRouter("/member/:id", &controllers.MemberController{}, "put:Update"),
			web.NSRouter("/member/:id", &controllers.MemberController{}, "delete:Delete"),
			web.NSRouter("/member/:id/points", &controllers.MemberController{}, "put:UpdatePoints"),
			web.NSRouter("/member/:id/balance", &controllers.MemberController{}, "put:UpdateBalance"),

			// 会员积分记录相关路由
			web.NSRouter("/member/points/log", &controllers.MemberPointsController{}, "get:List"),
			// 会员余额记录相关路由
			web.NSRouter("/member/balance/log", &controllers.MemberBalanceController{}, "get:List"),
			// 会员交易记录相关路由
			web.NSRouter("/member/transaction", &controllers.MemberTransactionController{}, "get:List"),

			// 会员等级相关路由
			web.NSRouter("/member/level", &controllers.MemberLevelController{}, "get:List"),
			web.NSRouter("/member/level", &controllers.MemberLevelController{}, "post:Create"),
			web.NSRouter("/member/level/:id", &controllers.MemberLevelController{}, "get:GetOne"),
			web.NSRouter("/member/level/:id", &controllers.MemberLevelController{}, "put:Update"),
			web.NSRouter("/member/level/:id", &controllers.MemberLevelController{}, "delete:Delete"),
			web.NSRouter("/member/level/all", &controllers.MemberLevelController{}, "get:GetAll"),

			// 会员卡相关路由
			web.NSRouter("/member/card", &controllers.MemberCardController{}, "get:List"),
			web.NSRouter("/member/card", &controllers.MemberCardController{}, "post:Create"),
			web.NSRouter("/member/card/:id", &controllers.MemberCardController{}, "get:GetOne"),
			web.NSRouter("/member/card/:id", &controllers.MemberCardController{}, "put:Update"),
			web.NSRouter("/member/card/:id", &controllers.MemberCardController{}, "delete:Delete"),

			// 支付渠道相关路由
			web.NSRouter("/payment/channel", &controllers.PaymentChannelController{}, "get:List"),
			web.NSRouter("/payment/channel", &controllers.PaymentChannelController{}, "post:Create"),
			web.NSRouter("/payment/channel/:id", &controllers.PaymentChannelController{}, "get:GetOne"),
			web.NSRouter("/payment/channel", &controllers.PaymentChannelController{}, "put:Update"),
			web.NSRouter("/payment/channel/:id", &controllers.PaymentChannelController{}, "delete:Delete"),
			web.NSRouter("/payment/channel/:id/test", &controllers.PaymentChannelController{}, "post:TestConnection"),

			// 支付交易记录相关路由
			web.NSRouter("/payment/transaction", &controllers.PaymentTransactionController{}, "get:List"),
			web.NSRouter("/payment/transaction/:id", &controllers.PaymentTransactionController{}, "get:GetOne"),

			// 退款管理相关路由
			web.NSRouter("/payment/refund", &controllers.RefundController{}, "get:GetList"),
			web.NSRouter("/payment/refund/:id", &controllers.RefundController{}, "get:GetOne"),
			web.NSRouter("/payment/refund/apply", &controllers.RefundController{}, "post:Apply"),
			web.NSRouter("/payment/refund/audit", &controllers.RefundController{}, "post:Audit"),
			web.NSRouter("/payment/refund/member", &controllers.RefundController{}, "get:GetMemberRefunds"),

			// 优惠券管理相关路由
			web.NSRouter("/coupon", &controllers.CouponController{}, "get:List"),
			web.NSRouter("/coupon", &controllers.CouponController{}, "post:Create"),
			web.NSRouter("/coupon/:id", &controllers.CouponController{}, "get:GetOne"),
			web.NSRouter("/coupon/:id", &controllers.CouponController{}, "put:Update"),
			web.NSRouter("/coupon/:id", &controllers.CouponController{}, "delete:Delete"),

			// 优惠券活动相关路由
			web.NSRouter("/coupon/activity", &controllers.CouponActivityController{}, "get:List"),
			web.NSRouter("/coupon/activity", &controllers.CouponActivityController{}, "post:Create"),
			web.NSRouter("/coupon/activity/:id", &controllers.CouponActivityController{}, "get:GetOne"),
			web.NSRouter("/coupon/activity/:id", &controllers.CouponActivityController{}, "put:Update"),
			web.NSRouter("/coupon/activity/:id", &controllers.CouponActivityController{}, "delete:Delete"),

			// 优惠券发放相关路由
			web.NSRouter("/coupon/issue/list", &controllers.CouponIssueController{}, "get:List"),
			web.NSRouter("/coupon/issue", &controllers.CouponIssueController{}, "post:Issue"),
			web.NSRouter("/coupon/batch_issue", &controllers.CouponIssueController{}, "post:BatchIssue"),
			web.NSRouter("/coupon/filter_issue", &controllers.CouponIssueController{}, "post:FilterIssue"),
			web.NSRouter("/coupon/issue/cancel", &controllers.CouponIssueController{}, "post:Cancel"),

			// 团购活动相关路由
			web.NSRouter("/groupbuy/activity", &controllers.GroupBuyActivityController{}, "get:List"),
			web.NSRouter("/groupbuy/activity", &controllers.GroupBuyActivityController{}, "post:Create"),

			// 保洁人员管理相关路由
			web.NSRouter("/cleaner", &controllers.CleanerController{}, "get:List"),
			web.NSRouter("/cleaner", &controllers.CleanerController{}, "post:Create"),
			web.NSRouter("/cleaner/:id", &controllers.CleanerController{}, "get:GetOne"),
			web.NSRouter("/cleaner/:id", &controllers.CleanerController{}, "put:Update"),
			web.NSRouter("/cleaner/:id", &controllers.CleanerController{}, "delete:Delete"),

			// 保洁设置管理相关路由
			web.NSRouter("/cleaning/setting", &controllers.CleaningSettingController{}, "get:List"),
			web.NSRouter("/cleaning/setting", &controllers.CleaningSettingController{}, "post:Create"),
			web.NSRouter("/cleaning/setting/:id", &controllers.CleaningSettingController{}, "get:Get"),
			web.NSRouter("/cleaning/setting/:id", &controllers.CleaningSettingController{}, "put:Update"),
			web.NSRouter("/cleaning/setting/:id", &controllers.CleaningSettingController{}, "delete:Delete"),

			// 保洁记录管理相关路由
			web.NSRouter("/cleaning/record", &controllers.CleaningRecordController{}, "get:List"),
			web.NSRouter("/cleaning/record", &controllers.CleaningRecordController{}, "post:Create"),
			web.NSRouter("/cleaning/record/:id", &controllers.CleaningRecordController{}, "get:GetOne"),
			web.NSRouter("/cleaning/record/:id", &controllers.CleaningRecordController{}, "put:Update"),
			web.NSRouter("/cleaning/record/:id", &controllers.CleaningRecordController{}, "delete:Delete"),

			web.NSRouter("/groupbuy/activity/:id", &controllers.GroupBuyActivityController{}, "get:GetOne"),
			web.NSRouter("/groupbuy/activity/:id", &controllers.GroupBuyActivityController{}, "put:Update"),
			web.NSRouter("/groupbuy/activity/:id", &controllers.GroupBuyActivityController{}, "delete:Delete"),
			web.NSRouter("/groupbuy/activity/active", &controllers.GroupBuyActivityController{}, "get:GetActiveActivities"),

			// 团购券核销相关路由
			web.NSRouter("/groupbuy/verify", &controllers.GroupBuyVerifyController{}, "get:List"),
			web.NSRouter("/groupbuy/verify/:id", &controllers.GroupBuyVerifyController{}, "get:GetOne"),
			web.NSRouter("/groupbuy/verify", &controllers.GroupBuyVerifyController{}, "post:Create"),

			// 团购订单相关路由
			web.NSRouter("/groupbuy/order", &controllers.GroupBuyOrderController{}, "get:List"),
			web.NSRouter("/groupbuy/order/:id", &controllers.GroupBuyOrderController{}, "get:GetOne"),
			web.NSRouter("/groupbuy/order/audit", &controllers.GroupBuyOrderController{}, "post:Audit"),
			web.NSRouter("/groupbuy/order/cancel", &controllers.GroupBuyOrderController{}, "post:Cancel"),

			// 团购统计相关路由
			web.NSRouter("/groupbuy/statistics", &controllers.GroupBuyStatisticsController{}, "get:GetStatistics"),

			// 订单管理相关路由
			web.NSRouter("/order", &controllers.OrderController{}, "get:List"),
			web.NSRouter("/order/pending", &controllers.OrderController{}, "get:GetPendingOrders"),
			web.NSRouter("/order/:id", &controllers.OrderController{}, "get:GetOne"),
			web.NSRouter("/order/status", &controllers.OrderController{}, "post:UpdateStatus"),
			web.NSRouter("/order/statistics", &controllers.OrderController{}, "get:GetStatistics"),
			web.NSRouter("/order/create_by_admin", &controllers.OrderController{}, "post:CreateByAdmin"),
			web.NSRouter("/order/reschedule", &controllers.OrderController{}, "post:Reschedule"),
			web.NSRouter("/order/check_availability", &controllers.OrderController{}, "get:CheckVenueAvailability"),

			// 在路由配置中添加批量获取接口
			// 优惠券相关路由部分添加
			web.NSRouter("/coupon/batch", &controllers.CouponController{}, "post:BatchGet"),

			// 会员相关路由部分添加
			web.NSRouter("/member/batch", &controllers.MemberController{}, "post:BatchGet"),

			// 注册订单相关路由
			web.NSRouter("/order/list", &controllers.OrderController{}, "get:List"),
			web.NSRouter("/order/detail/:id", &controllers.OrderController{}, "get:GetById"),
			web.NSRouter("/order/update/:id", &controllers.OrderController{}, "put:Update"),
			web.NSRouter("/order/statistics", &controllers.OrderController{}, "get:GetStatistics"),

			// 注册系统统计路由
			web.NSRouter("/statistics/overview", &controllers.StatisticsController{}, "get:GetOverview"),

			// 财务中心相关路由
			web.NSRouter("/finance/statistics", &controllers.FinanceController{}, "get:GetStatistics"),
			web.NSRouter("/finance/transaction", &controllers.FinanceController{}, "get:GetTransactionList"),
			web.NSRouter("/finance/transaction/:id", &controllers.FinanceController{}, "get:GetTransactionDetail"),
			web.NSRouter("/finance/transaction/export", &controllers.FinanceController{}, "get:ExportTransactions"),
			web.NSRouter("/finance/settlement", &controllers.FinanceController{}, "get:GetSettlementList"),
			web.NSRouter("/finance/settlement/:id", &controllers.FinanceController{}, "get:GetSettlementDetail"),
			web.NSRouter("/finance/settlement", &controllers.FinanceController{}, "post:CreateSettlement"),
			web.NSRouter("/finance/settlement/status", &controllers.FinanceController{}, "post:UpdateSettlementStatus"),

			// 设备管理相关路由
			web.NSRouter("/device", &controllers.DeviceController{}, "get:List"),
			web.NSRouter("/device", &controllers.DeviceController{}, "post:Create"),
			web.NSRouter("/device/:id", &controllers.DeviceController{}, "get:Detail"),
			web.NSRouter("/device/:id", &controllers.DeviceController{}, "put:Update"),
			web.NSRouter("/device/:id", &controllers.DeviceController{}, "delete:Delete"),
			web.NSRouter("/device/:id/status", &controllers.DeviceController{}, "put:UpdateStatus"),

			// 设备分组管理相关路由
			web.NSRouter("/device/group", &controllers.DeviceGroupController{}, "get:List"),
			web.NSRouter("/device/group", &controllers.DeviceGroupController{}, "post:Create"),
			web.NSRouter("/device/group/:id", &controllers.DeviceGroupController{}, "get:Detail"),
			web.NSRouter("/device/group/:id", &controllers.DeviceGroupController{}, "put:Update"),
			web.NSRouter("/device/group/:id", &controllers.DeviceGroupController{}, "delete:Delete"),
			web.NSRouter("/device/group/add_devices", &controllers.DeviceGroupController{}, "post:AddDevices"),
			web.NSRouter("/device/group/remove_devices", &controllers.DeviceGroupController{}, "post:RemoveDevices"),
			web.NSRouter("/device/group/devices", &controllers.DeviceGroupController{}, "get:GetDevices"),
			web.NSRouter("/device/groups", &controllers.DeviceGroupController{}, "get:GetGroups"),

			// 美团管理相关路由
			web.NSRouter("/meituan", &controllers.MeituanController{}, "get:List"),
			web.NSRouter("/meituan", &controllers.MeituanController{}, "post:Create"),
			web.NSRouter("/meituan/:id", &controllers.MeituanController{}, "get:GetOne"),
			web.NSRouter("/meituan/:id", &controllers.MeituanController{}, "put:Update"),
			web.NSRouter("/meituan/:id", &controllers.MeituanController{}, "delete:Delete"),
			web.NSRouter("/meituan/order", &controllers.MeituanController{}, "get:OrderList"),
			web.NSRouter("/meituan/order/:id", &controllers.MeituanController{}, "get:OrderDetail"),
			web.NSRouter("/meituan/order/process", &controllers.MeituanController{}, "post:ProcessOrder"),
			web.NSRouter("/meituan/sync/:id", &controllers.MeituanController{}, "post:SyncTest"),

			// 美团团购管理路由
			web.NSRouter("/meituan/group", &controllers.MeituanGroupController{}, "get:List"),
			web.NSRouter("/meituan/group", &controllers.MeituanGroupController{}, "post:Create"),
			web.NSRouter("/meituan/group/:id", &controllers.MeituanGroupController{}, "get:GetOne"),
			web.NSRouter("/meituan/group/:id", &controllers.MeituanGroupController{}, "put:Update"),
			web.NSRouter("/meituan/group/:id", &controllers.MeituanGroupController{}, "delete:Delete"),
			web.NSRouter("/meituan/group/order", &controllers.MeituanGroupOrderController{}, "get:List"),
			web.NSRouter("/meituan/group/order/:id", &controllers.MeituanGroupOrderController{}, "get:GetOne"),
			web.NSRouter("/meituan/group/order/process", &controllers.MeituanGroupOrderController{}, "post:ProcessOrder"),
			web.NSRouter("/meituan/group/order/use", &controllers.MeituanGroupOrderController{}, "post:UseVoucher"),
			web.NSRouter("/meituan/group/order/sync", &controllers.MeituanGroupOrderController{}, "post:SyncOrders"),

			// 抖音管理相关路由
			web.NSRouter("/douyin", &controllers.DouyinController{}, "get:List"),
			web.NSRouter("/douyin", &controllers.DouyinController{}, "post:Create"),
			web.NSRouter("/douyin/:id", &controllers.DouyinController{}, "get:Detail"),
			web.NSRouter("/douyin/:id", &controllers.DouyinController{}, "put:Update"),
			web.NSRouter("/douyin/:id", &controllers.DouyinController{}, "delete:Delete"),
			web.NSRouter("/douyin/:id/sync", &controllers.DouyinController{}, "post:Sync"),

			// 抖音团购活动相关路由
			web.NSRouter("/douyin/group", &controllers.DouyinGroupController{}, "get:List"),
			web.NSRouter("/douyin/group", &controllers.DouyinGroupController{}, "post:Create"),
			web.NSRouter("/douyin/group/:id", &controllers.DouyinGroupController{}, "get:Detail"),
			web.NSRouter("/douyin/group/:id", &controllers.DouyinGroupController{}, "put:Update"),
			web.NSRouter("/douyin/group/:id", &controllers.DouyinGroupController{}, "delete:Delete"),

			// 抖音团购订单相关路由
			web.NSRouter("/douyin/group/order", &controllers.DouyinGroupOrderController{}, "get:List"),
			web.NSRouter("/douyin/group/order/:id", &controllers.DouyinGroupOrderController{}, "get:Detail"),
			web.NSRouter("/douyin/group/order/:id/process", &controllers.DouyinGroupOrderController{}, "post:Process"),
			web.NSRouter("/douyin/group/order/:id/use", &controllers.DouyinGroupOrderController{}, "post:Use"),
			web.NSRouter("/douyin/group/order/sync", &controllers.DouyinGroupOrderController{}, "post:Sync"),
		),
	)

	ns_mini := web.NewNamespace("/mini",
		web.NSBefore(middleware.AppAuthMiddleware()),
		// 小程序轮播图列表接口 - 用于前端小程序获取
		web.NSRouter("/banner/list", &controllers.MiniprogramBannerController{}, "get:GetPublicList"),
		// 门店相关API
		web.NSRouter("/store/nearby", &controllers.MiniStoreController{}, "get:GetNearbyStores"),
		web.NSRouter("/store/hot", &controllers.MiniStoreController{}, "get:GetHotStores"),
		web.NSRouter("/store/:id", &controllers.MiniStoreController{}, "get:GetStoreDetail"),
		web.NSRouter("/store/:id/venues", &controllers.MiniStoreController{}, "get:GetStoreVenues"),
		web.NSRouter("/store/search", &controllers.MiniStoreController{}, "get:SearchStores"),
		// 城市相关API
		web.NSRouter("/city/list", &controllers.MiniCityController{}, "get:GetCityList"),
		web.NSRouter("/city/hot", &controllers.MiniCityController{}, "get:GetHotCities"),
		// 场馆类型相关API
		web.NSRouter("/venue_type", &controllers.MiniVenueTypeController{}, "get:GetAll"),
		// 场地相关API
		web.NSRouter("/venue/list", &api.VenueController{}, "get:List"),
		web.NSRouter("/venue/detail", &api.VenueController{}, "get:Detail"),
		web.NSRouter("/venue/timeslots", &api.VenueController{}, "get:TimeSlots"),
		web.NSRouter("/venue/timeline", &api.VenueController{}, "get:Timeline"),
		web.NSRouter("/venue/packages", &api.VenueController{}, "get:Packages"),
		web.NSRouter("/venue/check_available", &api.VenueController{}, "get:CheckAvailable"),
		// 小程序用户相关接口（无需认证）
		web.NSRouter("/user/openid", &controllers.MiniUserController{}, "post:GetOpenid"),
		web.NSRouter("/user/check", &controllers.MiniUserController{}, "get:CheckUserExist"),
		web.NSRouter("/user/login_or_register", &controllers.MiniUserController{}, "post:LoginOrRegister"),
		web.NSRouter("/user/login_code", &controllers.MiniUserController{}, "post:LoginWithCode"),
		web.NSRouter("/user/verify_code", &controllers.MiniUserController{}, "post:SendVerifyCode"),

		// 需要认证的用户接口
		web.NSNamespace("/auth",
			web.NSBefore(middlewares.JWTMiddleware()),
			web.NSRouter("/user/info", &controllers.MiniUserController{}, "get:GetUserInfo"),
			web.NSRouter("/user/account", &controllers.MiniUserController{}, "get:GetAccountInfo"),
			web.NSRouter("/user/update", &controllers.MiniUserController{}, "post:UpdateUserInfo"),
			web.NSRouter("/user/logout", &controllers.MiniUserController{}, "post:Logout"),
			web.NSRouter("/user/coupons", &controllers.MiniUserController{}, "get:GetMyCoupons"),
			// 获取积分变动记录
			web.NSRouter("/user/points/logs", &controllers.MiniUserController{}, "get:PointsLogs"),
			web.NSRouter("/user/balance/logs", &controllers.MiniUserController{}, "get:GetBalanceLogs"),

			// 签到相关接口
			web.NSRouter("/checkin/info", &controllers.MiniCheckinController{}, "get:GetCheckinInfo"),
			web.NSRouter("/checkin/do", &controllers.MiniCheckinController{}, "post:DoCheckin"),
			web.NSRouter("/checkin/history", &controllers.MiniCheckinController{}, "get:GetCheckinHistory"),

			// 会员充值相关接口
			web.NSRouter("/member/recharge", &controllers.MiniMemberRechargeController{}, "post:Create;get:List"),
			web.NSRouter("/member/recharge/notify", &controllers.MiniMemberRechargeController{}, "post:Notify"),

			// 充值套餐相关接口
			web.NSRouter("/recharge/package", &controllers.MiniRechargePackageController{}, "get:List"),
			web.NSRouter("/recharge/package/detail", &controllers.MiniRechargePackageController{}, "get:Get"),

			// 团购券相关接口
			web.NSRouter("/groupbuy/list", &api.GroupBuyController{}, "get:GetList"),
			web.NSRouter("/groupbuy/detail", &api.GroupBuyController{}, "get:GetDetail"),
			web.NSRouter("/groupbuy/buy", &api.GroupBuyController{}, "post:Buy"),
			web.NSRouter("/groupbuy/my", &api.GroupBuyController{}, "get:GetMyGroupBuy"),
			web.NSRouter("/groupbuy/range", &api.GroupBuyController{}, "get:GetUsageRange"),
			//优惠券相关接口
			web.NSRouter("/member/coupons", &api.CouponController{}, "get:GetMyCoupons"),
			web.NSRouter("/member/available_coupons", &api.CouponController{}, "get:GetAvailableCoupons"),
			web.NSRouter("/coupon/use", &api.CouponController{}, "post:UseCoupon"),
			web.NSRouter("/coupon/code", &api.CouponController{}, "get:GetCouponByCode"),
			web.NSRouter("/coupon/my", &api.CouponController{}, "get:GetMyCoupons"),
			web.NSRouter("/coupon/exchangeable", &api.CouponController{}, "get:GetExchangeableCoupons"),
			web.NSRouter("/coupon/exchange", &api.CouponController{}, "post:ExchangeCoupon"),
			web.NSRouter("/coupon/verify", &api.CouponController{}, "post:VerifyCoupon"),
			web.NSRouter("/coupon/range", &api.CouponController{}, "get:GetUsageRange"),

			// 添加预约订单相关路由
			web.NSRouter("/booking/list", &api.BookingController{}, "get:List"),
			web.NSRouter("/booking/detail", &api.BookingController{}, "get:Detail"),
			web.NSRouter("/booking/cancel", &api.BookingController{}, "post:Cancel"),
			web.NSRouter("/booking/update_status", &api.BookingController{}, "post:UpdateStatus"),
			web.NSRouter("/booking/create", &api.BookingController{}, "post:Create"),
			web.NSRouter("/booking/renew", &api.BookingController{}, "post:Renew"),
			web.NSRouter("/booking/renewable", &api.BookingController{}, "get:GetRenewableBookings"),

			// 添加预订单和支付相关路由
			web.NSRouter("/booking/create_pre_order", &api.BookingController{}, "post:CreatePreOrder"),
			web.NSRouter("/booking/confirm_order", &api.BookingController{}, "post:ConfirmOrder"),
			web.NSRouter("/booking/renew_pre_order", &api.BookingController{}, "post:RenewPreOrder"),
			web.NSRouter("/booking/confirm_renew_order", &api.BookingController{}, "post:ConfirmRenewOrder"),
			web.NSRouter("/booking/pay_params", &api.BookingController{}, "get:GetPayParams"),
			web.NSRouter("/booking/pay_notify", &api.BookingController{}, "post:PayNotify"),

			// 添加支付相关路由
			web.NSRouter("/payment/check_status", &api.PaymentController{}, "get:CheckStatus"),

			// 收藏相关接口
			web.NSRouter("/favorite/add", &controllers.FavoriteController{}, "post:AddFavorite"),
			web.NSRouter("/favorite/cancel", &controllers.FavoriteController{}, "post:CancelFavorite"),
			web.NSRouter("/favorite/list", &controllers.FavoriteController{}, "get:GetFavoriteList"),
			web.NSRouter("/favorite/check", &controllers.FavoriteController{}, "get:CheckIsFavorite"),

			// 设备相关接口
			web.NSRouter("/device/open_door", &api.DeviceController{}, "get:OpenDoor"),
		),
	)

	// 添加命名空间
	web.AddNamespace(ns)
	web.AddNamespace(ns_mini)

	// 注册JWT中间件
	web.InsertFilter("/api/*", web.BeforeRouter, middleware.JWTMiddleware())
	//接口权限中间件
	web.InsertFilter("/api/*", web.BeforeRouter, middleware.CheckPermission())
	//小程序接口中间件
}
